package org.kealinghornets.jchuah.buttons;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;



public class Level2activity extends MainActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_level2activity);
    }


public void push_button_topleft(View view){

    circleoff(R.id.left_circle2);
    push_button_2();

}


    public void push_button_topmid(View view){

        circleoff(R.id.middle_circle2);
        push_button_2();
    }


    public void push_button_topright(View view){

        togglecircle(R.id.left_circle2);
        togglecircle(R.id.middle_circle2);
        push_button_2();


    }


    public void push_button_botleft(View view){

        circleon(R.id.middle_circle2);
        push_button_2();

    }


    public void push_button_botmid(View view){

        circleon(R.id.left_circle2);
        circleon(R.id.middle_circle2);
        circleon(R.id.right_circle2);
        push_button_2();

    }




    public void push_button_botright(View view){

        View midcircle2;
        midcircle2 = findViewById(R.id.middle_circle2);
        if(midcircle2.getVisibility() == View.INVISIBLE){

            togglecircle(R.id.right_circle2);
            push_button_2();

        }

    }


    public void push_button_2(){

        View topleftcircle = findViewById(R.id.left_circle2);
        View topmidcircle = findViewById(R.id.middle_circle2);
        View toprightcircle = findViewById(R.id.right_circle2);

        if(topleftcircle.getVisibility() == View.INVISIBLE && topmidcircle.getVisibility() == View.INVISIBLE && toprightcircle.getVisibility() == View.INVISIBLE){
            Toast.makeText(this,"you win",Toast.LENGTH_SHORT).show();
            startActivity(new Intent(this, level3.class));
        }

    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_level2activity, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
